import request from '../utils/request'

// 获取用户的配送地址列表
export const getDeliveryAddressList = (userId) => {
  return request({
    url: `/deliveryaddress/listDeliveryAddressByUserId/${userId}`,
    method: 'get'
  })
}

// 获取用户的配送地址列表
export const getAddressList = (userId) => {
  return request({
    url: `/deliveryaddress/listDeliveryAddressByUserId/${userId}`,
    method: 'get'
  });
};

// 添加地址
export const addAddress = (data) => {
  return request({
    url: '/deliveryaddress',
    method: 'post',
    data
  })
}

// 根据id查询地址
export const getAddressById = (id) => {
  return request({
    url: `/deliveryaddress/${id}`,
    method: 'get'
  })
}

// 更新地址
export const updateAddress = (data) => {
  return request({
    url: '/deliveryaddress',
    method: 'put',
    data
  });
};

// 删除地址
export const deleteAddress = (id) => {
  return request({
    url: `/deliveryaddress/${id}`,
    method: 'delete'
  });
}; 